<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>16.this在闭包中的历史遗留问题</title>
</head>

<body>
  <script>
    let hd = {
      user: "后盾人",
      get: function () {
        let This = this
        return function () {
          return This.user; // this是特殊的对象，总是指向调用它的对象，普通的闭包不同
        };
      }
    };
    console.log(hd.get()()); //undefined，因为调用它的是window对象，this指向window，而window中不包含user
  </script>
</body>

</html>